<template>
  <el-row :gutter="5" class="panel-group">
    <el-row :gutter="5" class="panel-group">
      <el-col :xs="24" :sm="24" :lg="24">
        <el-card class="box-card" style="height: 190px">
          <div style="width: 150px; height: 10px; background-color: var(--primary-color);position:relative;top:-15px"></div>
          <div class="title20Class">
            <svg-icon icon-class="process"/>
            节点统计
          </div>
          <el-divider content-position="left"></el-divider>
          <el-col :xs="6" :sm="6" :lg="6" style="text-align: center;">
            <el-card class="box-card" style="background-color: #479FDD;color:#FFF;">
              <count-to :start-val="0" :end-val="number1" :duration="3000" class="card-panel-num"/>
              个
              <div class="card-panel-text">
                发起（修订）
              </div>
            </el-card>
          </el-col>
          <el-col :xs="6" :sm="6" :lg="6" style="text-align: center;">
            <el-card class="box-card" style="background-color: #479BCA;color:#FFF;">
              <count-to :start-val="0" :end-val="number2" :duration="3000" class="card-panel-num"/>
              个
              <div class="card-panel-text">
                会签
              </div>
            </el-card>
          </el-col>
          <el-col :xs="6" :sm="6" :lg="6" style="text-align: center;">
            <el-card class="box-card" style="background-color: #2A64AC;color:#FFF;">
              <count-to :start-val="0" :end-val="number3" :duration="3000" class="card-panel-num"/>
              个
              <div class="card-panel-text">
                审核
              </div>
            </el-card>
          </el-col>
          <el-col :xs="6" :sm="6" :lg="6" style="text-align: center;">
            <el-card class="box-card" style="background-color: #1C478A;color:#FFF;">
              <count-to :start-val="0" :end-val="number4" :duration="3000" class="card-panel-num"/>
              个
              <div class="card-panel-text">
                签发
              </div>
            </el-card>
          </el-col>
        </el-card>
      </el-col>
    </el-row>
    <el-row :gutter="5" class="panel-group">
      <el-col :xs="12" :sm="12" :lg="16">
        <el-card class="box-card" style="overflow-y:auto;height: 220px">
          <div style="width: 150px; height: 10px; background-color: var(--primary-color);position:relative;top:-15px"></div>
          <div class="title20Class">
            <svg-icon icon-class="process"/>
            最新流程
          </div>
          <el-divider content-position="left"></el-divider>
          <el-row v-for="item in list" :key="item.id">
            <div style="line-height: 30px;height: 30px;">
              <el-col :xs="12" :sm="12" :lg="12" class="t_border">{{ item.processName }}</el-col>
              <el-col :xs="6" :sm="6" :lg="6" class="t_border">{{ item.hostDeptName }}</el-col>
              <el-col :xs="6" :sm="6" :lg="6" class="t_border">{{ item.createTime }}</el-col>
            </div>
          </el-row>
        </el-card>
      </el-col>
      <el-col :xs="12" :sm="12" :lg="8">
        <el-card class="box-card" style="overflow-y:auto;height: 220px">
          <div style="width: 150px; height: 10px; background-color: var(--primary-color);position:relative;top:-15px"></div>
          <div class="title20Class">
            <svg-icon icon-class="process"/>
            帮助中心
          </div>
          <el-divider content-position="left"></el-divider>
          <el-col :xs="24" :sm="24" :lg="24">
            <el-row>
              <div style="line-height: 30px;height: 30px;text-align: center;">
                <el-col :xs="24" :sm="24" :lg="24" class="t_border">
                  <img style="width: 100px; height: 100px" class="pic-404__parent" src="@/assets/images/help.png">
                </el-col>
              </div>
            </el-row>
            <el-row>
              <div style="line-height: 30px;height: 30px;text-align: center;">
                <el-col :xs="24" :sm="24" :lg="24" class="t_border">
                  <span>查看操作手册-请扫二维码</span>
                </el-col>
              </div>
            </el-row>
          </el-col>
        </el-card>
      </el-col>
    </el-row>
  </el-row>
</template>

<script>
import CountTo from 'vue-count-to'
import { auditProcessByNode, newProcess } from '@/api/lc/index'

export default {
  components: {
    CountTo
  },
  data() {
    return {
      number1: 0,
      number2: 0,
      number3: 0,
      number4: 0,
      list: [],
      helpImg: '@/assets/images/help_code.png'
    }
  },
  created() {
    this.getAuditProcessByNode()
    this.getNewProcess()
  },
  methods: {
    /**
     * 节点分类
     */
    getAuditProcessByNode() {
      auditProcessByNode().then(res => {
        console.log('res', res.data.processAuditState0)
        this.number1 = res.data.processAuditState0 === undefined ? 0 : res.data.processAuditState0
        this.number2 = res.data.processAuditState1 === undefined ? 0 : res.data.processAuditState1
        this.number3 = res.data.processAuditState2 === undefined ? 0 : res.data.processAuditState2
        this.number4 = res.data.processAuditState3 === undefined ? 0 : res.data.processAuditState3
      })
    },
    /**
     * 近半年-最新制度
     */
    getNewProcess() {
      newProcess().then(res => {
        this.list = res.data
      })
    },
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    }
  }
}
</script>

<style lang="scss" scoped>
.panel-group {
  margin-top: 10px;

  .card-panel-col {
    margin-bottom: 32px;
    text-align: center;
  }

  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-shopping {
        background: #34bfa3
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

.t_border {
  border-bottom: 1px solid #ebeef5;
}

.card-panel-num {
  font-size: 20px;
}

.card-panel-text {
  font-size: 18px;
}

@media (max-width: 550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
